# 旋转图像


class Solution:

    def rotate(self, matrix):

        n = len(matrix)
        for i in range(n // 2):
            for j in range((n + 1) // 2):
                tmp = matrix[i][j]
                matrix[i][j] = matrix[n - 1 - j][i]
                matrix[n - 1 - j][i] = matrix[n - 1 - i][n - 1 - j]
                matrix[n - 1 - i][n - 1 - j] = matrix[j][n - 1 - i]
                matrix[j][n - 1 - i] = tmp



if __name__ == "__main__":

    a = [[1,2,3],[4,5,6],[7,8,9]]

    sol = Solution()
    sol.rotate(a)
    print(a)


